<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>货品信息列表</title>
<link href="<%=path%>/css/core.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/pagination.css" rel="stylesheet"
	type="text/css" />
<link href="<%=path%>/css/list.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/xToolbar.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/jquery-impromptu.css" rel="stylesheet"
	type="text/css" />
</head>
<body>
	<div id="toolbar"></div>
	<form id="listForm"
		action="<%=path%>/product/product/choosePagination.t4m" method="post">
		<table id="titleTable" cellpadding="0" cellspacing="0">
			<tr>
				<td>&nbsp;</td>
				<td><input type="checkbox" id="allBox" />
				</td>
				<td>货品编号</td>
				<td>货品名称</td>
				<td>品牌名称</td>
				<td>规格型号</td>
				<td>生产商</td>
				<td>零售价格</td>
				<td>折扣价格</td>
				<td>VIP价格</td>
				<td>税率</td>
			</tr>
		</table>
		<table id="dataTable" cellpadding="0" cellspacing="0">
			<s:iterator id="product" value="page.list" status="i">
				<tr class="row">
					<td class="num"><s:property value="#i.index+1" /></td>
					<td class="box"><input type="checkbox" name="idList" value="<s:property value="#product.id"/>"/></td>
					<td><span><s:property value="#product.code" default="&nbsp;"/></span></td>
					<td align="center"><span><s:property value="#product.name" default="&nbsp;"/></span></td>
					<td><span><s:property value="#product.brand" default="&nbsp;"/></span></td>
					<td><span><s:property value="#product.standard" default="&nbsp;"/></span></td>
					<td><span><s:property value="#product.manufacturer" default="&nbsp;"/></span></td>
					<td align="right"><span><s:property value="#product.normalPrice" default="&nbsp;"/></span></td>
					<td align="right"><span><s:property value="#product.discountPrice" default="&nbsp;"/></span></td>
					<td align="right"><span><s:property value="#product.vipPrice" default="&nbsp;"/></span></td>
					<td align="right"><span><s:property value="#product.tax" default="&nbsp;"/></span></td>
				</tr>
			</s:iterator>
		</table>
      <s:hidden name="productTypeId" id="productTypeId"/>
		<s:hidden name="productId" />
		<s:include value="/share/pagebar.jsp" />
	</form>

	<script src="<%=path%>/js/core.js" type="text/javascript"></script>
	<script src="<%=path%>/js/share.js" type="text/javascript"></script>
	<script src="<%=path%>/js/jquery.js" type="text/javascript"></script>
	<script src="<%=path%>/js/Grid.js" type="text/javascript"></script>
	<script src="<%=path%>/js/BoxSelect.js" type="text/javascript"></script>
	<script src="<%=path%>/js/xToolbar.js" type="text/javascript"></script>
	<script src="<%=path%>/js/xToolbar.items.js" type="text/javascript"></script>
	<script src="<%=path%>/js/jquery-impromptu.js" type="text/javascript"></script>
	<script type="text/javascript">
	$(document).ready(function(){
	      new Toolbar({
	        id: '1',
	        renderTo : 'toolbar',
	        icon: '../../image/op.gif',
	        items : [{
	          type:'button',
	          text:'选择',
	          useable : 'T',
	          //useable : '<s:property value="@org.team4.util.Meta@getOperate(\"product_new\")"/>',
	          position: {
	            a: '0px 0px',
	            b: '0px -120px'
	          },
	          handler:function(){
	            choose();
	          }
	        },'-',{
	          type:'button',
	          text:'选择并关闭',
	          useable : 'T',
	          //useable : '<s:property value="@org.team4.util.Meta@getOperate(\"product_new\")"/>',
	          position: {
	            a: '0px 0px',
	            b: '0px -120px'
	          },
	          handler:function(){
	            choose();
	            parent.close();
	          }
	        }]
	      });
	      
	      new Grid({
	        titleTable:'titleTable',
	        dataTable:'dataTable',
	        widths : [30,24,60,140,140,140,140,140,100,100,80],
	        height : function(){return getGridHeight({toolbarId:'toolbar',hasPage:true});}
	      });
	      
	      new BoxSelect({
	        allId : 'allBox',
	        boxName : 'idList'
	      });
	      
	      loadReady();
	    });
	
	function choose() {
	  if(getFirstID()) {
      var dataArray = [];
      var datas = $('#dataTable tr.selected');
      datas.each(function(i){
        var tds = $('td', this);
        dataArray[i] = {
          id: tds.eq(1).children('input[name="idList"]').val(),
          code: tds.eq(2).text(),
          name: tds.eq(3).text(),
          brand: tds.eq(4).text(),
          standard: tds.eq(5).text(),
          manufacturer: tds.eq(6).text(),
          normalPrice: tds.eq(7).text(),
          discountPrice: tds.eq(8).text(),
          vipPrice: tds.eq(9).text(),
          tax: tds.eq(10).text()
        };
      });
      parent.opener.addData(dataArray);
    }
	}
    </script>
</body>
</html>